<html>
<head><meta charset="utf-8"><title>const-qualified proc macros? · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const-qualified.20proc.20macros.3F.html">const-qualified proc macros?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="197243042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const-qualified%20proc%20macros%3F/near/197243042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const-qualified.20proc.20macros.3F.html#197243042">(May 12 2020 at 07:55)</a>:</h4>
<p>Has anybody done any thinking on eventually allowing <code>const</code> on the procedural macro functions as a way of telling the compiler that it doesn't need to re-run the macro on every compilation if the input of the macro hasn't changed?</p>



<a name="197243967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const-qualified%20proc%20macros%3F/near/197243967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const-qualified.20proc.20macros.3F.html#197243967">(May 12 2020 at 08:04)</a>:</h4>
<p>I was <em>told</em> that if the tokens passed to an invocation match the previous tokens passed it already skips re-running the proc-macro.</p>



<a name="197244760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const-qualified%20proc%20macros%3F/near/197244760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> isHavvy <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const-qualified.20proc.20macros.3F.html#197244760">(May 12 2020 at 08:13)</a>:</h4>
<p>If that's true, that should definitely be stated clearly in documentation. It could also be useful in the sense that a const-qualified proc macro is guaranteed not to talk to the Internet, but that's a minor benefit.</p>



<a name="197256944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const-qualified%20proc%20macros%3F/near/197256944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const-qualified.20proc.20macros.3F.html#197256944">(May 12 2020 at 10:29)</a>:</h4>
<blockquote>
<p>I was told that if the tokens passed to an invocation match the previous tokens passed it already skips re-running the proc-macro.</p>
</blockquote>



<a name="197257011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const-qualified%20proc%20macros%3F/near/197257011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const-qualified.20proc.20macros.3F.html#197257011">(May 12 2020 at 10:30)</a>:</h4>
<p>Maybe that's true for rust-analyzer or something like that, but certainly not for rustc.</p>



<a name="197340496"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const-qualified%20proc%20macros%3F/near/197340496" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const-qualified.20proc.20macros.3F.html#197340496">(May 12 2020 at 21:15)</a>:</h4>
<p>That I would say is probably "the goal we're shooting for" more than the status quo :)</p>



<a name="197340539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const-qualified%20proc%20macros%3F/near/197340539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const-qualified.20proc.20macros.3F.html#197340539">(May 12 2020 at 21:15)</a>:</h4>
<p>but I don't see any reason it wouldn't work with the query system, once we push it back far enough</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>